package com.data.center.dictionary;

import com.data.center.exception.exception.BizException;
import com.data.center.exception.info.CommonEnum;

/**
 * @author DN
 * @description:学位代码映射枚举类CD000006
 * @date 2023/11/30 17：30
 */
public enum AcademicDegree implements KeyValueMap {
    HONORARY_DOCTOR("1", "名誉博士"),
    DOCTOR("2", "博士"),
    DOCTOR_PHILOSOPHY("201", "哲学博士学位"),
    DOCTOR_ECONOMICS("202", "经济学博士学位"),
    DOCTOR_LAW("203", "法学博士学位"),
    DOCTOR_EDUCATION("204", "教育学博士学位"),
    DOCTOR_LITERATURE("205", "文学博士学位"),
    DOCTOR_HISTORY("206", "历史学博士学位"),
    DOCTOR_SCIENCE("207", "理学博士学位"),
    DOCTOR_ENGINEERING("208", "工学博士学位"),
    DOCTOR_AGRICULTURE("209", "农学博士学位"),
    DOCTOR_MEDICINE("210", "医学博士学位"),
    DOCTOR_MILITARY("211", "军事学博士学位"),
    DOCTOR_MANAGEMENT("212", "管理学博士学位"),
    DOCTOR_CLINICAL_MEDICINE("245", "临床医学博士专业学位"),
    DOCTOR_VETERINARY_MEDICINE("248", "兽医博士专业学位"),
    DOCTOR_ORAL_MEDICINE("250", "口腔医学博士专业学位"),
    MASTER("3", "硕士"),
    MASTER_PHILOSOPHY("301", "哲学硕士学位"),
    MASTER_ECONOMICS("302", "经济学硕士学位"),
    MASTER_LAW("303", "法学硕士学位"),
    MASTER_EDUCATION("304", "教育学硕士学位"),
    MASTER_LITERATURE("305", "文学硕士学位"),
    MASTER_HISTORY("306", "历史学硕士学位"),
    MASTER_SCIENCE("307", "理学硕士学位"),
    MASTER_ENGINEERING("308", "工学硕士学位"),
    MASTER_AGRICULTURE("309", "农学硕士学位"),
    MASTER_MEDICINE("310", "医学硕士学位"),
    MASTER_MILITARY("311", "军事学硕士学位"),
    MASTER_MANAGEMENT("312", "管理学硕士学位"),
    MASTER_LAW_PROFESSIONAL("341", "法律硕士专业学位"),
    MASTER_EDUCATION_PROFESSIONAL("342", "教育硕士专业学位"),
    MASTER_ENGINEERING_PROFESSIONAL("343", "工程硕士专业学位"),
    MASTER_ARCHITECTURE_PROFESSIONAL("344", "建筑学硕士专业学位"),
    MASTER_CLINICAL_MEDICINE_PROFESSIONAL("345", "临床医学硕士专业学位"),
    MASTER_BUSINESS_MANAGEMENT_PROFESSIONAL("346", "工商管理硕士专业学位"),
    MASTER_AGRICULTURAL_EXTENSION_PROFESSIONAL("347", "农业推广硕士专业学位"),
    MASTER_VETERINARY_PROFESSIONAL("348", "兽医硕士专业学位"),
    MASTER_PUBLIC_MANAGEMENT_PROFESSIONAL("349", "公共管理硕士专业学位"),
    MASTER_ORAL_MEDICINE_PROFESSIONAL("350", "口腔医学硕士专业学位"),
    MASTER_PUBLIC_HEALTH_PROFESSIONAL("351", "公共卫生硕士专业学位"),
    MASTER_MILITARY_PROFESSIONAL("352", "军事硕士专业学位"),
    BACHELOR("4", "学士"),
    BACHELOR_PHILOSOPHY("401", "哲学学士学位"),
    BACHELOR_ECONOMICS("402", "经济学学士学位"),
    BACHELOR_LAW("403", "法学学士学位"),
    BACHELOR_EDUCATION("404", "教育学学士学位"),
    BACHELOR_LITERATURE("405", "文学学士学位"),
    BACHELOR_HISTORY("406", "历史学学士学位"),
    BACHELOR_SCIENCE("407", "理学学士学位"),
    BACHELOR_ENGINEERING("408", "工学学士学位"),
    BACHELOR_AGRICULTURE("409", "农学学士学位"),
    BACHELOR_MEDICINE("410", "医学学士学位"),
    BACHELOR_MILITARY("411", "军事学学士学位"),
    BACHELOR_MANAGEMENT("412", "管理学学士学位"),
    BACHELOR_ARCHITECTURE_PROFESSIONAL("444", "建筑学学士专业学位"),
    OTHER("9", "其他");

    private String code;
    private String name;

    AcademicDegree(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public String getKey() {
        return code;
    }

    @Override
    public String getValue() {
        return name;
    }

    public static AcademicDegree getValueByKey(String key) {
        for (AcademicDegree academicDegree : values()) {
            if (academicDegree.code.equals(key)) {
                return academicDegree;
            }
        }
        throw new BizException(CommonEnum.CAN_NOT_FIND_IN_DICTIONARY);
    }

    public static AcademicDegree getKeyByValue(String value) {
        for (AcademicDegree academicDegree : values()) {
            if (academicDegree.name.equals(value)) {
                return academicDegree;
            }
        }
        throw new BizException(CommonEnum.CAN_NOT_FIND_IN_DICTIONARY);
    }
}
